<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title><?php echo $this->_var['p_id']['cate_name']; ?>-贺喜时尚商城</title>
<?php echo $this->fetch('header.html'); ?>

<div class="category">
                <div class="container clearfix">
                    <div class="aside">
                        <ul>
                            <?php $_from = $this->_var['categories']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
                            <li><a <?php if ($this->_var['c']['cate_id'] == $this->_var['cate_id']): ?>style="color: #4FA5AF;" <?php endif; ?> href="
                                <?php echo url('app=default&act=category&id=' . $this->_var['c']['cate_id']. ''); ?>"><?php echo $this->_var['c']['cate_name']; ?></a></li>
                            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                        </ul>
                         <ul>
                             <?php $_from = $this->_var['price']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'p');$this->_foreach['name'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['name']['total'] > 0):
    foreach ($_from AS $this->_var['key'] => $this->_var['p']):
        $this->_foreach['name']['iteration']++;
?>
                             <?php if ($this->_var['key'] == 0): ?><li>全部价格</li><?php endif; ?>
                             <li><a href="index.php?app=default&act=category&id=<?php echo $this->_var['cate_id']; ?>&price=<?php echo $this->_var['p']['min']; ?> - <?php echo $this->_var['p']['max']; ?>">￥<?php echo $this->_var['p']['min']; ?>
                                 - ￥<?php echo $this->_var['p']['max']; ?></a></li>
                             <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                        </ul>
                    </div>
                    <div class="category-container">
                        <div class="category-top">
                            <h2><?php echo $this->_var['p_id']['cate_name']; ?></h2>
                            <div>
                                排序方式:
                                <select  class="order" >
                                    <option value="desc" <?php if ($this->_var['order'] == 'desc'): ?>selected="selected"<?php endif; ?>>价格从高到低</option>
                                    <!--<option value="<?php echo url('app=default&act=category&id=&order=desc'); ?>" <?php if ($this->_var['order'] == 'desc'): ?>selected="selected"<?php endif; ?>>价格从高到低</option>-->
                                    <option value="asc" <?php if ($this->_var['order'] == 'asc'): ?>selected="selected"<?php endif; ?>>价格从低到高</option>
                                </select>
                            </div>
                        </div>
                        <div class="category-con">
                            <ul>
                                <?php $_from = $this->_var['goods']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'g');if (count($_from)):
    foreach ($_from AS $this->_var['g']):
?>
                                <li>
                                    <div class="item">
                                        <a href="<?php echo url('app=goods&act=index&id=' . $this->_var['g']['goods_id']. ''); ?>">
                                            <img width="280" height="280" src="<?php echo $this->_var['g']['default_image']; ?><?php echo $this->_var['goods_index_img']; ?>">
                                        </a>
                                        <span>
                                            <p><span class="icon"></span><?php echo $this->_var['g']['collect']; ?></p>
                                            <div>销量:<?php echo $this->_var['g']['sale']; ?></div>
                                        </span>
                                    </div>
                                    <h3><a href="<?php echo url('app=goods&act=index&id=' . $this->_var['g']['goods_id']. ''); ?>" title="<?php echo $this->_var['g']['goods_name']; ?>"><?php echo $this->_var['g']['sub_goods_name']; ?></a>
                                    </h3>
                                    <p>￥<?php echo $this->_var['g']['price']; ?><span>￥<?php echo $this->_var['g']['market_price']; ?></span></p>
                                </li>
                                <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                            </ul>
                        </div>
                        <!-- <div class="category-dot">
                            <a class="arrow arrow-left"></a>
                            <a class="dot cur" data-id="0">1</a>
                            <a class="dot" data-id="1">2</a>
                            <a class="dot" data-id="2">3</a>
                            <a class="arrow arrow-right"></a>
                        </div> -->
                        <div class="category-dot">
                            <?php if ($this->_var['page_info']['prev_link']): ?>
                            <a href="<?php echo $this->_var['page_info']['prev_link']; ?>" class="arrow arrow-left"></a>
                            <?php endif; ?>
                            <?php $_from = $this->_var['page_info']['page_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('k', 'v');if (count($_from)):
    foreach ($_from AS $this->_var['k'] => $this->_var['v']):
?>
                            <a <?php if ($this->_var['page_info']['curr_page'] == $this->_var['k']): ?>class="cur dot"<?php endif; ?>href="<?php echo $this->_var['v']; ?>" class="dot" data-id="100"><?php echo $this->_var['k']; ?></a>
                            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                            <?php if ($this->_var['page_info']['next_link']): ?>
                            <a href="<?php echo $this->_var['page_info']['next_link']; ?>" class="arrow arrow-right"></a>
                            <?php endif; ?>


                            <input type="hidden" name="page_count" value="<?php echo $this->_var['page_info']['page_count']; ?>"/>
                        </div>
                    </div>
                </div>
            </div>
            <input type="hidden" name="price" value="<?php echo $this->_var['pp']; ?>"/>
<script type="text/javascript">
    
    $("em.page_submit").click(function(){
        var cate_id = '<?php echo $this->_var['cate_id']; ?>';
        var page = $(".page_num").val();
        //得到最大页数
        var page_count = $("input[name='page_count']").val();

        if(parseInt(page_count) < parseInt(page))
        {
            location.href="<?php echo url('app=default&act=category&id="+cate_id+"&page="+page_count+"'); ?>";
        }else{
            location.href="<?php echo url('app=default&act=category&id="+cate_id+"&page="+page+"'); ?>";
        }

    })
    
    $("select.order").change(function(){
        var cate_id = '<?php echo $this->_var['cate_id']; ?>';
        var order = $(this).children('option:selected').val();
        var price = $("input[name='price']").val();
        var conditions = "";
        if(price){
            conditions += "&price="+price;
        }
        if(cate_id != ""){
            conditions += "&id="+cate_id;
        }
        location.href="index.php?app=default&act=category"+conditions+"&order="+order;
    })
</script>
<?php echo $this->fetch('footer.html'); ?>